/*
 * Copyright (c) 2021.版权所有高金磊
 */

package 领扣算法.A简单题.生成交替二进制字符串的最少操作数;

public class Main {
    public int minOperations(String s) {
        char[] data=s.toCharArray();
        int res1=0;
        int res2=0;
        for (int i = 0; i < data.length; i++) {
            if (i%2!=data[i]-'0'){
                res1++;
            }
            else {
                res2++;
            }

        }
        return Math.min(res1, res2);
    }
}
